-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom-metadata, exists, info methods #207
Conversation
2f3d446
to
9b2da42
Compare
c67e610
to
f85be2c
Compare
f85be2c
to
cdd361e
Compare
cdd361e
to
dbd5883
Compare
Is this merge waiting a certain release cycle? For what it's worth, the code looks fine to me. |
Hey folks, super eager to start using this.
+1 Desperately need this feature 🙏 |
Hey, yeah, we're also waiting on this feature for a while. |
Is there an estimated timescale for merging of this PR and subsequent release? |
+1 for merging. This one is more important to me than a lot of stuff which got released in last launch weeks. Sometimes supabase team loses sight of the basic requirements still missing like this one... |
Apologies for the delay guys, i'm aiming to have this merged this week. |
🎉 This issue has been resolved in version 2.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@fenos I'm confused about the implementation of the storage-js/src/packages/StorageFileApi.ts Lines 566 to 568 in dbd5883
which seems to be deprecated in the API docs and upon testing this release I get StorageApiError: Object not found errors. |
Hey @danvoyce do you have RLS for selecting the object? The route is probably marked as deprecated mistakingly, thanks for point that out |
@fenos, well the bucket is public and I'm using the service key. import { StorageClient } from '@supabase/storage-js'
const STORAGE_URL = 'url'
const SERVICE_KEY = 'service key' //! service key, not anon key
const storageClient = new StorageClient(STORAGE_URL, {
apikey: SERVICE_KEY,
Authorization: `Bearer ${SERVICE_KEY}`,
})
const data = await storageClient.from("test").info("test.txt") //test is a public bucket
console.log(data.error) //StorageApiError: Object not found
console.log(data.data)
const exists = await storageClient.from("test").exists("test.txt")
console.log(exists.data) // true |
Is there a rollout plan for this in the main supabase-js package @kiwicopple ? |
@cipriancaba yes, here is the PR |
Hey @fenos you know when it's likely to be merged? I see it's been approved already 🤓 |
@fenos it's currently not possible to add new RLS policies to the objects table. Is there a way to allow users to modify the metadata somehow? |
Is there documentation on how to add metadata through TUS uploads? The PR here indicates TUS is supported: supabase/storage#518 |
This is awesome, but neither the Guide nor the Javascript reference documentation mention this capability. Please, please, update the documentation when new features are added. Thanks! |
Any documentation available for this yet? |
I am also facing the same issue as @jan-tennert. For me its showing
although file is uploading correctly but info throws the above error Also documentation would be great |
Or, using Uppy: new Uppy({
// ...
onBeforeFileAdded(file) {
file.meta = {
...file.meta,
bucketName: BUCKET,
objectName: file.name,
contentType: file.type,
metadata: JSON.stringify({ test: "hello" }),
};
return file;
},
})
.use(Tus, {
// ...
allowedMetaFields: ["bucketName", "objectName", "contentType", "cacheControl", "metadata"],
// ...
}),
); |
Same issue on my end. I can fetch the file and download it, and I can call the exists method on it and it returns true. If I call the .info method, it returns It works if I append either let { data: info } = await supabase.storage
.from("public/my-bucket")
.info("my_photo.png"); |
What kind of change does this PR introduce?
Feature
What is the new behavior?
Custom Metadata
Adds support for custom metadata on objects:
Exists / Info
added 2 new methods, exists and info
Info
fetches the information about this object
Exists
Check if a file exists
Relates to supabase/storage#439